package com.doudanhua.basecode.controller;

import com.doudanhua.basecode.cache.CacheDemo;
import com.doudanhua.basecode.dto.DogDto;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zhangqian
 * @Description TODO
 * @Date 2022/11/7 21:33
 */
@RestController
@RequestMapping("cache")
public class CacheController {
    private final CacheDemo cacheDemo;

    public CacheController(CacheDemo cacheDemo) {
        this.cacheDemo = cacheDemo;
    }

    @GetMapping("{id}")
    public DogDto getDto(@PathVariable long id) {
        return cacheDemo.getDog(id);
    }
}
